package com.lemonfish.pojo.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import java.util.List;

/**
 * 权限 Entity定义
 *
 * @author Lemonfish
 * @version 1.0
 * @date 2020-03-02
 * Copyright © ï¿½Å³ï¿½
 */
@ApiModel(value = "权限")
@Getter
@Setter
@Accessors(chain = true)
@ToString
public class Permission extends BaseCustomEntity {

    private static final long serialVersionUID = -47352446525414L;

    // 路径
    @ApiModelProperty(value = "路径", example = "/user")
    @Length(max = 100, message = "路径长度应小于100")
    @TableField()
    private String path;

    // 组件
    @ApiModelProperty(value = "组件", example = "")
    @Length(max = 100, message = "组件长度应小于100")
    @TableField()
    private String url;

    // 图标
    @ApiModelProperty(value = "图标", example = "el-icon-user")
    @Length(max = 20, message = "图标长度应小于20")
    @TableField()
    private String icon;

    // 父类ID
    @ApiModelProperty(value = "父类ID", example = "1")
    @TableField()
    private Long parentId;

    // 名字
    @ApiModelProperty(value = "名字", example = "book")
    @Length(max = 20, message = "名字长度应小于20")
    @TableField()
    private String name;

    // 等级
    @ApiModelProperty(value = "等级", example = "一级")
    @Length(max = 20, message = "等级长度应小于20")
    @TableField()
    private String level;

    // 标签
    @ApiModelProperty(value = "标签", example = "书籍管理")
    @Length(max = 30, message = "标签长度应小于30")
    @TableField()
    private String label;

    @TableField(exist = false)
    private List<Permission> children;
}
